/***************************************
 *Header name: Manip.h                 *
 *Author: Gu Zhengxiong                *
 *Version: 2013.11.22.2                *
 *Description:The header defines a     *
 *structure, MANIP.                    *
 ***************************************/

# include "StudentInfo.h"
# include "StudentGrade.h"
# include "Student.h"

# ifndef STUDENT_MANAGEMENT_MANIP_H
# define STUDENT_MANAGEMENT_MANIP_H

# define ALL_INFO_FORMAT "      %s %s %s %d\n"//Need to mend
# define ALL_INFO_PARA ps_tmp->pi->number, ps_tmp->pi->name, ps_tmp->pi->address, ps_tmp->pi->age
# define ALL_GRADE_FORMAT "      %s | %s | %g | %g | %g\n"
# define ALL_GRADE_PARA ps_tmp->pi->number, ps_tmp->pi->name, ps_tmp->pg->maths, ps_tmp->pg->clang, ps_tmp->pg->english

enum
SearchType
{
	SEARCH_NUM = 1, SEARCH_NAME
};

typedef struct _Manip
{
	PSTUDENT (*Construct) (void);
	void (*DisplayInfo)(PSTUDENT);
	void (*DisplayGrade) (PSTUDENT);
	void (*Add) (PSTUDENT, PINFO, PGRADE);
	PSTUDENT (*Inquire) (PSTUDENT, int, char *);
	PSTUDENT (*InquireBefore) (PSTUDENT, int, char *);
	void (*Destroy) (PSTUDENT);
}
MANIP,
*PMANIP;

PMANIP
ManipInitialize (void);
PSTUDENT
Construct (void);
void
DisplayInfo (PSTUDENT phead);
void
DisplayGrade (PSTUDENT phead);
void
Add (PSTUDENT phead, PINFO pi, PGRADE pg);
PSTUDENT
Inquire (PSTUDENT phead, int type, char * s);
PSTUDENT
InquireBefore (PSTUDENT phead, int type, char * s);
void
Destroy (PSTUDENT ps);

# endif